{$header}<div id="main" class="main" >
    <div class="content">
  <h3 class="heading">新增客户退货单 [ <a href="__URL__">返回列表</a> ]</h3>
<div id="result" class="result none"></div>
<form class="form-horizontal well" method='post' id="form1" name="form1" action="__URL__/insert/">
    注意：一个退货单只能处理一个客户的退货--TODO 暂支持批发订单的退货
<table cellpadding=3 cellspacing=3 >
<tr>
    <td class="tRight" width="150px">退货单号：</td>
	<td class="tLeft" >
            <input  class="large" name="sale_back_no" value="">

            销售退货时间：<input type="text" class="span2" name="create_time" value="{:toDate(time())}" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})">
        </td>
</tr>
    <tr>
    <td class="tRight" width="150px">按<b>销售单号或客户姓名</b>查询：</td>
	<td class="tLeft" >
            <input id="sale_search" name="sale_id" style="width:700px"></input>
            <br/><a class="btn btn-primary" href="javascript:void(0)" onclick="showdetail('sale','sale_back');">添加销售单</a>
        </td>
</tr>
<tr>
	<td class="tRight" >按<b>拼音首字母</b>查询产品：</td>
	<td class="tLeft" >
            <input id="ppy" name="ppy_id" style="width:700px"></input>
            <br/><a class="btn btn-primary" href="javascript:void(0)" onclick="showdetail('ppy','sale_back2');">添加产品</a>
        </td>
</tr>
<tr>
    <td class="tRight" >按<b>汉字</b>查询产品：</td>
    <td class="tLeft" >
            <div class="input-append">
                <input id="q" name="q" class="input-xlarge search-query" placeholder="搜索"><input id="hz" name="hz_id" type="hidden"></input>
                <button class="btn" type="button" onclick="filter('sale_back2')"><i class="icon-search"></i>搜索</button>
                <span class="help-inline alert">支持空格查询,如:名称 + 度数</span>
            </div>
        </td>
</tr>
<tr>
	<td class="tRight">选择的产品：</td>
        <td class="tLeft">
            <table id="chosed_product" class="table table-bordered table-striped">
                <thead><tr><th>销售单号</th><th>条码</th><th>品名</th><th>规格</th> <th>售价</th><th>退货原因</th><th>数量</th><th>单位</th><th>库存</th><th>生产批号</th><th width="75px">截止有效期</th><th>删除</th></tr></thead>
            </table>
        </td>
</tr>
<tr>
	<td class="tRight" >经办人：</td>
	<td class="tLeft" >
            <select name="user_id">
                <volist name="users" id="us">
                <option value="{$key}" <eq name="_SESSION[C('USER_AUTH_KEY')]" value="$key">selected</eq> >{$us}</option>
                </volist>
            </select>
            仓库：<select name="warehouse_id">
                <volist name="warehouses" id="ue">
                <option value="{$key}">{$ue}</option>
                </volist>
            </select>
            客户：
            <?php 
            //仅企业客户--批发
            $customers = M('Customer')->where('type = 5')->field('id,name')->findAll(); ?>
            <select name="customer_id">
                <volist name="customers" id="cu">
                    <option value="{$cu.id}">{$cu.name}</option>
                </volist>
            </select>
            </select>
        </td>
</tr>
<tr>
	<td class="tRight">备注：</td>
        <td class="tLeft"><textarea class="span12" name="remark" rows="3"></textarea>
        </td>
</tr>
<tr>
	<td></td>
	<td class="center" width="300">
	<button type="submit" class="btn btn-primary"><i class="icon-ok icon-white"></i> 保存</button>
	<a class="btn btn-primary offset1" href="__URL__"><i class="icon-arrow-left icon-white"></i>返回</a>
	</td>
</tr>
</table>
</form>
</div>
</div>
<include file="Public:footer" />
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Js/easyui/themes/default/easyui.css">
<script type="text/javascript" src="__PUBLIC__/Js/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/Js/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/Js/filter-product.js"></script>
<load href="__PUBLIC__/Js/My97DatePicker/WdatePicker.js" />
<script type="text/javascript">
    $('#sale_search').combogrid({
    panelWidth:700,
    url: URL+'/filter_order',
    idField:'id',
    textField:'sale_no',
    mode:'remote',
    fitColumns:true,
    columns:[[
        {field:'id',title:'销售编号',width:40},
        {field:'sale_no',title:'销售单号',align:'left',width:80},
        {field:'name',title:'客户',align:'left',width:80},
        {field:'create_time',title:'销售时间',align:'right',width:50}
    ]]
});

</script>
